// components/infocard/infocard.js
const datetime = require('../../utils/datetime');

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    publishTime: {
      type: Number,
      value: 0
    },
    heading: {
      type: Object,
      value: {}
    },
    hasAppendix: {
      type: Boolean,
      value: false
    },
    appendix: {
      type: Array,
      value: []
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    publishTimeString: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
  },

  observers: {
    publishTime: function (n){
      this.setData({
        publishTimeString: datetime.toFriendlyTime(n)
      });
    }
  }
})
